package in.abip.chisame.model;

import android.content.res.Resources;
import in.abip.chisame.R;

/**
 * Remote Record
 * 
 * @author Julot
 * @since Friday, April 29th, 2011
 */
public class Remote extends CActiveRecord implements IListItem {
	public Integer roomId = null;
	public Integer host = null;
	public Integer typeId = null;
	public String name = null;
	
	public static Remote model() {
		return new Remote();
	}
	
	/**
	 * Get list icon drawable resource according to type.
	 * @return {@link Resources}
	 */
	public int getListIconResource() {
		switch (typeId) {
		case 1:
			return R.drawable.ic_list_remote_type_1;
		default:
			return R.drawable.ic_list_remote_type_2;
	    }
	}
	
	public String getListText() {
		return ((name == null) || (name.equals(""))) ? "Remote" : name;
	}
	
	public String getRunCmd(Integer value) {
		return Long.toString(100 + _id).substring(1) + 
			Integer.toString(100 + value).substring(1) + 
			Integer.toString(100);
	}
}
